# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Thomas S Hatch <thatch45@gmail.com>
# Contributor: shamrok <szamrok@gmail.com>
# Contributor: scj <scj archlinux us>

pkgname=python-levenshtein
pkgver=0.21.0
pkgrel=2
pkgdesc="Python extension for computing string edit distances and similarities"
url="https://pypi.python.org/pypi/python-Levenshtein/"
license=('GPL')
arch=('loong64' 'x86_64')
depends=('python-rapidfuzz')
makedepends=('python-scikit-build' 'cython' 'rapidfuzz-cpp')
checkdepends=('python-pytest')
#source=("https://files.pythonhosted.org/packages/source/L/Levenshtein/Levenshtein-$pkgver.tar.gz")
source=("https://github.com/maxbachmann/Levenshtein/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('bb1cf70497e89db5b427eb4ac79708d205fc9edfc9588d30c63ef6e3e77b9369c8892edc31c32cb135d54947e8eedb770d06a7d5c6f8743d44378d7d1a12d459')

build() {
  cd Levenshtein-$pkgver
  python setup.py build
}

check() {
  cd Levenshtein-$pkgver
  PYTHONPATH=`echo "$PWD"/_skbuild/linux-x86_64-*/setuptools/lib.linux-x86_64-*` \
  pytest
}

package() {
  cd Levenshtein-$pkgver
  python setup.py install -O1 --root="$pkgdir"
}
